﻿<UserControl x:Class="ForumsBrowser.UserTokenControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:fb="clr-namespace:ForumsBrowser" >
    <UserControl.Resources>
        <ResourceDictionary>
            <Style TargetType="TextBlock">
                <Setter Property="FontSize" Value="10"/>
            </Style>
            <Style TargetType="{x:Type fb:DateBlock}">
                <Setter Property="FontSize" Value="10"/>
            </Style> 
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="DefaultStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Border Grid.Column="2">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <fb:ImageToken Grid.Column="0" ImageUrl="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type fb:UserTokenControl}}, Path=User.Image}" Margin="0,0,2,0"/>
            <Grid Grid.Column="1" VerticalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <fb:DateBlock AutoUpdate="True" Grid.Row="0" x:Name="tbCreatedOn" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type fb:UserTokenControl}}, Path=DateValue }"/>
                <TextBlock Grid.Row="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type fb:UserTokenControl}}, Path=User.DisplayName}"/>
                <fb:MedalControl Grid.Row="2" Achieved="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type fb:UserTokenControl}}, Path=User.Stars}" Height="10"/>
            </Grid>  
        </Grid>
    </Border>
</UserControl>
